package net.wesc.ac.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class AboutDialog extends DialogBox{
    public AboutDialog() {
    	setText("About WESC");
		setAnimationEnabled(false);
		setGlassEnabled(true);
		setModal(true);
		final Button closeButton = new Button("Close");
		VerticalPanel dialogPanel = new VerticalPanel();
		ScrollPanel contentPanel = new ScrollPanel();
		dialogPanel.setSize("600px", "300px");
		dialogPanel.setHorizontalAlignment(VerticalPanel.ALIGN_LEFT);
		contentPanel.setSize("580px", "260px");
		dialogPanel.add(contentPanel);
		dialogPanel.add(closeButton);
		dialogPanel.addStyleName("dialogVPanel");
		
		String content = "<p style='text-indent: 2em'><img src=images/logo.png></img><font color=red>W</font>eb <font color=yellow>E</font>lectrolyte <font color=green>S</font>olution <font color=red>C</font>alculator is a web-based program suit for activity coefficients fitting and plotting of electrolyte in aqueous solution.</p>" + 
						 "<p>Author: Li Dongdong Email: <a href=mailto:ddong_li@hotmail.com>ddong_li@hotmail.com</a></p>" +
						 "<p>Copyright &#169; Qinghai Institute of Salt Lakes, CAS. 2011-2012 All Rights Reserved.</p>" +
						 "<p>Download Manual: <a href=manual/manual.pdf>User's Manual</a></p>";
		contentPanel.setWidget(new HTML(content));
		setWidget(dialogPanel);
		center();
		// Add a handler to close the DialogBox
		closeButton.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				AboutDialog.this.hide();
			}
		});
    }
}
